namespace ConsoleApplication2.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class InitialCreate : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.tb_User",
                c => new
                    {
                        UserId = c.Int(nullable: false, identity: true),
                        UserName = c.String(nullable: false, maxLength: 20),
                        UserPwd = c.String(nullable: false, maxLength: 20),
                    })
                .PrimaryKey(t => t.UserId);
            
            CreateTable(
                "dbo.tb_Album",
                c => new
                    {
                        AlbumId = c.Int(nullable: false, identity: true),
                        AlbumName = c.String(),
                        CreateTime = c.String(),
                        User_UserId = c.Int(),
                    })
                .PrimaryKey(t => t.AlbumId)
                .ForeignKey("dbo.tb_User", t => t.User_UserId)
                .Index(t => t.User_UserId);
            
            CreateTable(
                "dbo.tb_Photo",
                c => new
                    {
                        PhotoId = c.Int(nullable: false, identity: true),
                        PhotoName = c.String(),
                        CreateTime = c.DateTime(nullable: false),
                        Album_AlbumId = c.Int(),
                    })
                .PrimaryKey(t => t.PhotoId)
                .ForeignKey("dbo.tb_Album", t => t.Album_AlbumId)
                .Index(t => t.Album_AlbumId);
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.tb_Photo", new[] { "Album_AlbumId" });
            DropIndex("dbo.tb_Album", new[] { "User_UserId" });
            DropForeignKey("dbo.tb_Photo", "Album_AlbumId", "dbo.tb_Album");
            DropForeignKey("dbo.tb_Album", "User_UserId", "dbo.tb_User");
            DropTable("dbo.tb_Photo");
            DropTable("dbo.tb_Album");
            DropTable("dbo.tb_User");
        }
    }
}
